from django_socio_grpc import proto_serializers
import safeguardgrpc.grpc.safeguardgrpc_pb2 as safeguardgrpc_pb2
from .models import Network, File, Mount, Process

class NetworkProtoSerializer(proto_serializers.ModelProtoSerializer):
    class Meta:
        model = Network
        proto_class = safeguardgrpc_pb2.NetworkResponse # Modification here
        proto_class_list = safeguardgrpc_pb2.NetworkListResponse # Modification here
        #fields = ["Action", "Hostname", "PID", "Comm", "ParentComm", "Addr", "Domain", "Port", "Protocol"]
        fields = '__all__'

class FileProtoSerializer(proto_serializers.ModelProtoSerializer):
    class Meta:
        model = File
        proto_class = safeguardgrpc_pb2.FileResponse # Modification here
        proto_class_list = safeguardgrpc_pb2.FileListResponse # Modification here
        #fields = ["Action", "Hostname", "PID", "UID", "UName", "Comm", "ParentComm", "Path"]
        fields = '__all__'

class MountProtoSerializer(proto_serializers.ModelProtoSerializer):
    class Meta:
        model = Mount
        proto_class = safeguardgrpc_pb2.MountResponse # Modification here
        proto_class_list = safeguardgrpc_pb2.MountListResponse # Modification here
        fields = '__all__'

class ProcessProtoSerializer(proto_serializers.ModelProtoSerializer):
    class Meta:
        model = Process
        proto_class = safeguardgrpc_pb2.ProcessResponse # Modification here
        proto_class_list = safeguardgrpc_pb2.ProcessListResponse # Modification here
        #fields = ["Hostname", "PID", "PPID", "Comm", "ParentComm"]
        fields = '__all__'
